<template>
	<view class="page-content">
		<view class="header-box">
			<image class="image_4"
				src="https://ide.code.fun/api/image?token=66078e54d52b7700115185b5&name=73e00fefe998196ad182009ca4210742.png" />
		</view>
		<view class="content-box">
			<view class="flex-col relative section">
				<view class="flex-col group_4">
					<view class="flex-row items-center self-stretch group_5">
						<view class="section_2"></view>
						<text class="font ml-9">宠物线索</text>
					</view>
					<text class="self-center font_2 text_2">
						{{formdata.feature}}
					</text>
					<view class="flex-row justify-between equal-division">
						<view class="flex-col items-start equal-division-item">
							<text class="font_3">品种</text>
							<text class="font_2 mt-11">{{formdata.breed}}</text>
						</view>
						<view class="flex-col items-start group_6 equal-division-item">
							<text class="font_3">性别</text>
							<text class="font_2 mt-11">{{formdata.gender===0?'公':'母'}}</text>
						</view>
					</view>
				</view>
				<view class="flex-col group_7">
					<view class="flex-row items-center group_8">
						<view class="section_2"></view>
						<text class="font ml-9">发现地点</text>
					</view>
					<view class="flex-col justify-start items-start section_3">
						<map style="width: 100%; height: 320rpx;border-radius: 16rpx 16rpx 16rpx 16rpx;" :latitude="formdata.lng"
							:longitude="formdata.lat" :markers="covers">
						</map>
						<!-- <view class="section_4"></view> -->
					</view>
				</view>
			</view>
		</view>
		<view class="bottom-box">
			<view class="flex-col justify-start items-center button text-wrapper" @click="handleToChat(formdata.userId)">
				<text class="font">联系发布人</text>
			</view>
		</view>
	</view>
</template>

<script>
	import reportLoss from "../../../api/reportLoss.js";
	export default {
		data() {
			return {
				formdata: {
					breed: "", //品种
					discoveryLocation: "", //	发现地点
					feature: "", //特征
					frontalView: "", //正面照
					gender: 0,
					lat: 0,
					leftSideView: "",
					lng: 0,
					remark: "",
					rightSideView: "",
				},
				covers: []
			}
		},
		onLoad(option) {
			this.getDetail(option.id)
		},
		methods: {
			getDetail(id) {
				reportLoss.getPetReportLossById(id).then(res => {
					if (res.code === 200) {
						this.formdata = res.data;
						this.covers = [{
							latitude: res.data.lng,
							longitude: res.data.lat,
							iconPath: '/static/common/location-mark.png',
							width: 14,
							height: 22
						}]
					} else {
						uni.showToast({
							title: '请求失败',
							icon: 'none'
						})
					}
					console.log(res);
				}).catch(err => {
					uni.showToast({
						title: '请求失败',
						icon: 'none'
					})
					console.log(err);
				})
			},
			handleToChat(id) {
				uni.navigateTo({
					url: '/pages/news/user-chat/user-chat?userId=' + id
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.page-content {
		.header-box {
			height: 744rpx;

			>image {
				height: 744rpx;
				width: 100%;
			}
		}

		.content-box {
			position: relative;
			z-index: 99;

			.mt-11 {
				margin-top: 22rpx;
			}

			.ml-9 {
				margin-left: 18rpx;
			}

			.section {
				margin: -88rpx 32rpx 0;
				padding-top: 48rpx;
				background-color: #ffffff;
				border-radius: 24rpx;

				.group_4 {
					padding-bottom: 36rpx;
					border-bottom: solid 8rpx #f6f6f6;

					.group_5 {
						padding: 0 32rpx;
					}

					.font_2 {
						font-size: 28rpx;
						font-family: PingFang SC;
						font-weight: 700;
						color: #000000;
					}

					.text_2 {
						margin-top: 28rpx;
						line-height: 34rpx;
						width: 586rpx;
					}

					.equal-division {
						align-self: stretch;
						margin-top: 16rpx;

						.equal-division-item {
							padding: 8rpx 36rpx;
							width: 261.2rpx;
						}

						.group_6 {
							margin-right: 24rpx;
						}

						.font_3 {
							font-size: 24rpx;
							font-family: PingFang SC;
							color: #999999;
						}
					}
				}

				.group_7 {
					padding: 0 32rpx 48rpx;

					.group_8 {
						padding: 44rpx 0 24rpx;
					}

					.section_3 {
						border-radius: 16rpx;
						height: 320rpx;
						width: 100%;
						overflow: hidden;

						// .section_4 {
						// 	margin-left: 292rpx;
						// 	background-color: #fbd610;
						// 	box-shadow: 0rpx 8rpx 8rpx #00000040;
						// 	border-radius: 50%;
						// 	width: 24rpx;
						// 	height: 24rpx;
						// 	border-left: solid 4rpx #ffffff;
						// 	border-right: solid 4rpx #ffffff;
						// 	border-top: solid 4rpx #ffffff;
						// 	border-bottom: solid 4rpx #ffffff;
						// }
					}
				}

				.section_2 {
					background-color: #fbd610;
					border-radius: 6rpx;
					width: 8rpx;
					height: 40rpx;
				}

				.font {
					font-size: 32rpx;
					font-family: PingFang SC;
					font-weight: 700;
					color: #000000;
				}
			}
		}

		.bottom-box {
			padding: 32rpx 0;
			background-color: #FFFFFF;

			.button {
				margin: 0 32rpx;

				.font {
					font-size: 32rpx;
					font-family: PingFang SC;
					font-weight: 700;
					color: #000000;
				}
			}

			.text-wrapper {
				padding: 28rpx 0;
				background-color: #fbd610;
				border-radius: 68rpx;
				overflow: hidden;
			}
		}
	}
</style>